<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1"/>
    <meta name="keywords" content=""/>
    <meta name="description" content=""/>
    <title>交易记录</title>

    <link th:href="@{/style/bootstrap.min.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/style/mui.min.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/style/basic.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/style/index.css}" rel="stylesheet" type="text/css"/>
    <script src="http://static.runoob.com/assets/vue/1.0.11/vue.min.js"></script>
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <![endif]-->
    <style>
        .transaRecord {
            border: solid #E8E8E8 1px;
            border-radius: 5px;
            background: white;
            padding: 16px 16px !important;
            margin: 20px auto !important;
            width: 95%;
            text-align: left;
        }

        .transaItem {
            display: flex;
            line-height: 0.26rem;
        }
    </style>
</head>

<body>
<div class="container-fluid">
    <div class="row">
        <div class="head">
            <a class="reback"></a>
            <a class="rebacktxt" href="javascript:history.go(-1)">返回</a>交易记录</div>
        <!-- 主要内容 -->
        <div id="content" class="content cf" style="text-align: center;align-items: center;">
            <div id="pullup-container" class="mui-scroll-wrapper" style="margin-top: 30px;">
                <div class="mui-scroll">
                    <template v-for="item in tranList">
                        <div class="transaRecord">
                            <h3 class="m_b_10">交易提醒</h3>
                            <div class="transaItem">
                                <div>交易时间</div>
                                <div class="total m_l_30">{{item.tranDateTime}}</div>
                            </div>
                            <div class="transaItem">
                                <div>交易金额</div>
                                <div class="total m_l_30">¥{{item.tranAmt /100}}</div>
                            </div>
                            <div class="transaItem">
                                <div>消费商户</div>
                                <div class="total m_l_30">{{item.rummeryEnName}}</div>
                            </div>
                            <div class="transaItem">
                                <div>消费用户</div>
                                <div class="total m_l_30">{{item.empName}}</div>
                            </div>
                            <div class="transaItem">
                                <div>用户公司</div>
                                <div class="total m_l_30">{{item.orgName}}</div>
                            </div>
                            <div class="transaItem">
                                <div>消费类型</div>
                                <div class="total m_l_30">{{item.tranType}}</div>
                            </div>
                        </div>
                    </template>
                </div>
            </div>
            <!-- end 主要内容 -->
        </div>
    </div>
</div>
<!--JavaScript插件都是依赖与jQuery库-->
<script th:src="@{/script/jquery.min.js}"></script>
<script th:src="@{/script/mui.min.js}"></script>
<script th:src="@{/script/mui.pullToRefresh.js}"></script>
<script th:src="@{/script/mui.pullToRefresh.material.js}"></script>
<script th:src="@{/script/bootstrap.min.js}"></script>
<script>
    var pageNo = 0;
    var pageSize = 10;
    var content = new Vue({
        el: "#content",
        data: {
            tranList: {}
        },
        methods: {
            getTranList: function (pageno,self) {
                var obj = new Object();
                obj.pageNo = pageno;
                obj.count = pageSize;
                $.ajax({
                    type: "POST",
                    url: "/server/getTranList",
                    data: obj,
                    beforeSend: function (data) {

                    },
                    success: function (data) {
                        if (data.errcode == "00000") {
                            var listobject= new Array();
                            listobject = data.result.data;
                            if (listobject == null || listobject.length == 0) {
                                self.endPullupToRefresh(true);
                            } else {
                                if (pageNo == 1) {
                                    content.tranList = listobject
                                } else {
                                   // content.tranList.concat(listobject);
                                    content.tranList= content.tranList.concat(listobject);
                                }
                                if (pageSize >listobject.length) {
                                    self.endPullupToRefresh(true);
                                }else{
                                    self.endPullupToRefresh(false);
                                }
                            }

                        }
                    },
                    error: function () {

                    }
                })
            }
        }
    });
    mui.init({
        pullRefresh: {
            container: "#pullup-container", //待刷新区域标识，querySelector能定位的css选择器均可，比如：id、.class等
            up: {
                height: 50, //可选.默认50.触发上拉加载拖动距离
                auto: true, //可选,默认false.自动上拉加载一次
                contentrefresh: "正在加载...", //可选，正在加载状态时，上拉加载控件上显示的标题内容
                contentnomore: '没有更多数据了', //可选，请求完毕若没有更多数据时显示的提醒内容；
                callback: function () {
                    pageNo++;
                    content.getTranList(pageNo,this);
                } //必选，刷新函数，根据具体业务来编写，比如通过ajax从服务器获取新数据；
            }
        }
    });
</script>
</body>

</html>